home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
tpfast30.zip
/
FASTFILE.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-09-26
|
23KB
|
461 lines
; _______________________________________________________________
; | |
; | Copyright (C) 1989,1990 Steven Lutrov |
; |_______________________________________________________________|____
; | | |
; | Program Title : Fastfile.Asm | | ___
; | Author : Steven Lutrov | | |
; | Revision : 2.01 | | |
; | Date : 1990-03-16 | | |
; | Language : Turbo Assembler | | |
; | | | |
; | | | |
; | Description : Assembly functions For primitive file | | |
; | : handeling. | | |
; | : Tested on Turbo Pascal Turbo Pascal 5.5 | | |
; | | | |
; |_______________________________________________________________| | |
; | | |
; |________________________________________________________________| |
; | |
; |_________________________________________________________________|
;
Code Segment Word Public
Assume Cs:Code,Ds:Data
Public Closefile,Createfile,Erasefile,Fmovepointer,Openfile,Readfile,
Public Writefile,Getverify,Getvolume,Readsector,Setverify,Setvolume
Public Writesector
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;Function Getverify: Boolean;
;
;
Getverify Proc Far
Mov Ah,54H ;Dos Func To Get Verify
Int 21H ;Get Status
Ret
Getverify Endp
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;Function Getvolume(Disk: Integer; Workarea: Pointer): Stype;
;
;
Getvolume Proc Far
Push Bp ;Save Turbos Bp
Mov Bp,Sp ;
Push Ds ;Save Turbo'S Ds
Mov Ah,2Fh ;Save Current Dta
Int 21H ;
Push Es ;
Push Bx ;
Cld ;Set Direction Flag
Lds Dx,Dword Ptr[Bp+6] ;Ds:Dx Pts To Workarea
Mov Ah,1Ah ;Function To Set Dta
Int 21H ;Set Dta
Mov Si,Dx ;Point Si To Dta
Mov Al,[Bp+10] ;Get Drive Specifier
Or Al,Al ;0 = Current Drive
Jnz Getv1 ;Jump If Not Current
Mov Ah,19H ;Dos Func To Get Drv Num
Int 21H ;Get Current Drive
Inc Al ;Count Drives From 1
Getv1: Add Al,64 ;Convert To A:, B: Etc.
Mov [Si],Al ;Write It
Inc Si ;Forward Ptr
Mov Al,':' ;Colour To Follow Drv Spec
Mov [Si],Al ;Write It
Inc Si ;Forward Ptr
Mov Al,'*' ;Global Character
Mov [Si],Al ;Write It
Inc Si ;Forward Ptr
Mov Al,'.' ;Global Character
Mov [Si],Al ;Write It
Inc Si ;Forward Ptr
Mov Al,'*' ;Global Character
Mov [Si],Al ;Write It
Inc Si ;Forward Ptr
Mov Al,0 ;Terminate With 0
Mov [Si],Al ;Write It
Mov Cx,8 ;Attribute For Vol Label
Les Di,Dword Ptr[Bp+12] ;Point To Return String
Mov Ah,4Eh ;Function To Seek File
Int 21H ;Seek Vol Label
Jnc Getv2 ;Jump If Found
Mov Byte Ptr Es:[Di],0 ;Set Null String Descriptor
Jmp Getv5 ;Go Quit
Getv2: Inc Di ;Forward Pointer To First Char
Mov Si,Dx ;Si To Start Of Workarea
Add Si,30 ;Offset To Vol Label
Sub Cl,Cl ;Count Strx Len In Cl
Getv3: Lodsb ;Get A Byte
Or Al,Al ;Test For Terminating 0
Jz Getv4 ;Jump When Finished
Cmp Al,'.' ;Period?
Je Getv3 ;Skip It If So
Stosb ;Transfer Char
Inc Cl ;Inc Length Counter
Jmp Short Getv3 ;Go Get Next
Getv4: Les Di,Dword Ptr[Bp+12] ;Return String Address
Mov Es:[Di],Cl ;Set Descriptor
Getv5: Pop Dx ;Restore Prior Dta
Pop Ds ;
Mov Ah,1Ah ;
Int 21H ;
Pop Ds ;
Pop Bp
Ret 6
Getvolume Endp
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;Procedure Readsector(Segment,Offset,Drive,Sector,Number: Word);
;
;
Data Segment
Extrn Errreturn:Byte
Data Ends
;
;
Readsector Proc Far
Push Bp ;Save Bp
Mov Bp,Sp ;Set Up Stack Frame
Push Ds ;Save Ds
Lds Bx,Dword Ptr[Bp+12] ;Get Buffer Address
Mov Al,[Bp+10] ;Drive Code
Dec Al ;Adjust For Turbo
Mov Dx,[Bp+8] ;Logical Sector Number
Mov Cx,[Bp+6] ;Number Sectors To Read
Int 25H ;Read The Sector(S)
Mov Bl,0 ;0 = No Error
Jnc Rsec1 ;Test For Error
Mov Bl,Ah ;Error Code To Bl
Rsec1: Pop Cx ;Balance Stack
Pop Ds ;Restore Ds
Pop Bp ;Restore Bp
Mov Errreturn,Bl ;Set Error Code
Ret 10
Readsector Endp
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;Procedure Setverify(Setting: Boolean);
;
;
Setverify Proc Far
Mov Bx,Sp ;
Sub Dl,Dl ;Dl Must = 0
Mov Al,Ss:[Bx+4] ;1 = On, 0 = Off
Mov Ah,2Eh ;Dos Func To Set Verify
Int 21H ;Set Verification
Ret 2
Setverify Endp
;=-=